package com.hongpu.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NonNull;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 项目的回款与支出明细
 * @TableName hp_project_work_pay_list
 */
@TableName(value ="hp_project_work_pay_list")
@Data
public class HpProjectWorkPayList implements Serializable {
    /**
     * 主键
     */
    @TableId(value = "id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long id;

    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @TableField(exist = false)
    private Long parentId;


    /**
     * 项目的回款与支出ID
     */
    @TableField(value = "project_work_pay_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long projectWorkPayId;


    /**
     * 约定时间
     */
    @TableField(value = "appointed_time")
    @JsonFormat(pattern = "yyyy-MM-dd", locale = "zh_CN")
    private Date appointedTime;

    /**
     * 实际时间
     */
    @TableField(value = "actual_time")
    @JsonFormat(pattern = "yyyy-MM-dd", locale = "zh_CN")
    private Date actualTime;

    /**
     * 合同中约定的每次回款额
     */
    @TableField(value = "contract_amount")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    private BigDecimal contractAmount;

    /**
     * 已支付
     */
    @TableField(value = "paid")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    private BigDecimal paid =  BigDecimal.ZERO;;

    /**
     * 未支付
     */
    @TableField(value = "unpaid")
    @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "#.##")
    private BigDecimal unpaid =  BigDecimal.ZERO;;

    /**
     * 合同内容
     */
    @TableField(value = "contract_content")
    private String contractContent;
    /**
     * 回款单位/支付单位
     */
    @TableField(value = "pay_unit")
    private String payUnit;
    /**
     * 备注
     */
    @TableField(value = "remark")
    private String remark;


    /**
     * 数据生成时间
     */
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    /**
     * 数据修改时间
     */
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    /**
     * 数据生成操作人ID
     */
    @TableField(value = "create_by",fill = FieldFill.INSERT)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long createBy;

    /**
     * 数据修改操作人ID
     */
    @TableField(value = "update_by",fill = FieldFill.UPDATE)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long updateBy;

    /**
     * 数据逻辑删除标识
     */
    @TableField(value = "deleted",fill = FieldFill.INSERT)
    @TableLogic
    private Integer deleted;

    /**
     * 租户ID
     */
    @TableField(value = "tenant_id")
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    private Long tenantId;


    /**
     * 是否开发票。1=是，0=否
     */
    @TableField(exist = false)
    private Integer invoiceOrNot;

    /**
     * 发票类型；1=普票。2=增值税
     */
    @TableField(exist = false)
    private Integer invoiceType;

    /**
     * 发票税率
     */
    @TableField(exist = false)
    private BigDecimal invoiceTaxRate;

    /**
     * 不含税金额
     */
    @TableField(exist = false)
    private BigDecimal amountBeforeTax;

    /**
     * 税额
     */
    @TableField(exist = false)
    private BigDecimal theAmountOfTaxToBePaid;


    /**
     * 是否已经对外开出发票。1=已开，0=未开，2=部分已开
     */
    @TableField(value = "it_has_been_invoiced")
    private Integer itHasBeenInvoiced;



    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        HpProjectWorkPayList other = (HpProjectWorkPayList) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getProjectWorkPayId() == null ? other.getProjectWorkPayId() == null : this.getProjectWorkPayId().equals(other.getProjectWorkPayId()))
            && (this.getAppointedTime() == null ? other.getAppointedTime() == null : this.getAppointedTime().equals(other.getAppointedTime()))
            && (this.getActualTime() == null ? other.getActualTime() == null : this.getActualTime().equals(other.getActualTime()))
            && (this.getContractAmount() == null ? other.getContractAmount() == null : this.getContractAmount().equals(other.getContractAmount()))
            && (this.getPaid() == null ? other.getPaid() == null : this.getPaid().equals(other.getPaid()))
            && (this.getUnpaid() == null ? other.getUnpaid() == null : this.getUnpaid().equals(other.getUnpaid()))
            && (this.getContractContent() == null ? other.getContractContent() == null : this.getContractContent().equals(other.getContractContent()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getProjectWorkPayId() == null) ? 0 : getProjectWorkPayId().hashCode());
        result = prime * result + ((getAppointedTime() == null) ? 0 : getAppointedTime().hashCode());
        result = prime * result + ((getActualTime() == null) ? 0 : getActualTime().hashCode());
        result = prime * result + ((getContractAmount() == null) ? 0 : getContractAmount().hashCode());
        result = prime * result + ((getPaid() == null) ? 0 : getPaid().hashCode());
        result = prime * result + ((getUnpaid() == null) ? 0 : getUnpaid().hashCode());
        result = prime * result + ((getContractContent() == null) ? 0 : getContractContent().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", projectWorkPayId=").append(projectWorkPayId);
        sb.append(", appointedTime=").append(appointedTime);
        sb.append(", actualTime=").append(actualTime);
        sb.append(", contractAmount=").append(contractAmount);
        sb.append(", paid=").append(paid);
        sb.append(", unpaid=").append(unpaid);
        sb.append(", contractContent=").append(contractContent);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}